/**
 * @date 9:11:53 AM
 * EducationQuestion.java
 * Administrator
 * TODO
 */
package com.qs.education.bean.entity;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Getter;
import lombok.Setter;

/**
 * @class EducationQuestion
 * @author Warren
 * @description
 * @date Nov 15, 2018
 */
@Entity
@Table(name = "education_question")
@Setter
@Getter
public class EducationQuestion {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	private String title;
	private String description;
	private String image;
	private String type;
	private Integer level;
	private Integer active;
	private Long correctCount;
	private Long errorCount;
	private String correctAnswer;
	private Long realeaseCount;

	@ManyToOne
	@JoinColumn(name = "lesson_id")
	@JsonIgnoreProperties(value = { "questionList" })
	private EducationSubjectLesson lesson;

	@OneToMany
	@JoinColumn(name = "question_id")
	@JsonIgnoreProperties(value = { "question" , "educationStudentQuestionList"})
	private List<EducationAnswer> answerList;

	@OneToMany
	@JoinColumn(name = "question_id")
	@JsonIgnoreProperties(value = { "question", "homework" })
	private List<EducationHomeWorkQuestion> homeWorkQuestionList;

	@Override
	public String toString() {
		return "EducationQuestion [id=" + id + ", title=" + title + ", description=" + description + ", image=" + image
				+ ", type=" + type + ", level=" + level + ", active=" + active + ", correctCount=" + correctCount
				+ ", errorCount=" + errorCount + ", correctAnswer=" + correctAnswer + ", realeaseCount=" + realeaseCount
				+ "]";
	}
}
